#include "pixel.h"

namespace sleek
{
    namespace texture
    {
        pixel::pixel()
        {
            red = green = blue = alpha = 255;
        }
        pixel::pixel(core::u8 r, core::u8 g, core::u8 b, core::u8 a)
        {
            red = r;
            green = g;
            blue = b;
            alpha = a;
        }
        pixel::~pixel()
        {
        }
        /* ***************************************** */
        void pixel::setRed(core::u8 i)
        {
            red = i;
        }
        void pixel::setGreen(core::u8 i)
        {
            green = i;
        }
        void pixel::setBlue(core::u8 i)
        {
            blue = i;
        }
        void pixel::setAlpha(core::u8 i)
        {
            alpha = i;
        }
        /* ***************************************** */
        core::u8 pixel::getRed()
        {
            return red;
        }
        core::u8 pixel::getGreen()
        {
            return green;
        }
        core::u8 pixel::getBlue()
        {
            return blue;
        }
        core::u8 pixel::getAlpha()
        {
            return alpha;
        }
        core::u8 pixel::getLuminaissance()
        {
            return (red+green+blue)/3;
        }
        pixel pixel::monochrome()
        {
            pixel tmp = monochrome_with_alpha();
            tmp.setAlpha(255);
            return tmp;;
        }
        pixel pixel::monochrome_with_alpha()
        {
            core::u8 luminaissance = getLuminaissance();
            return pixel(luminaissance,luminaissance,luminaissance,alpha);
        }
    }
}
